A three-dimensional clock powered by QuickDrawェ 3D
Jadeユs End Software
ゥ Copyright 1996 John David N. Dionisio
dondi@cs.ucla.edu
About Clock^3
Clock^3 (pronounced メclock cubedモ) is a clock program that works in the third dimension. Thanks to Appleユs QuickDrawェ 3D technology, the clocks that Clock^3 displays in its windows are fully interactive three-dimensional objects that you can rotate, zoom into or out of, and otherwise manipulate in full 3D space. Standard 3DMF (3-dimensional metafile format) models can also be imported into Clock^3 and given a set of simple clock hands. Those with more advanced 3D modeling software can create full-blown clocks in 3DMF; details are provided below.
Clock^3 is a module in a suite of three-dimensional applications collectively called Cubicle. Cubicle is a set of fully three-dimensional, interactive desk accessories. Another already-released module is Eyes^3, a three-dimensional eyes program. Watch out for additional QuickDrawェ 3D-savvy Cubicle programs from this developer.
Because Clock^3 uses Appleユs QuickDrawェ 3D technology, it requires a Power Macintosh with at least 16M of RAM. Needless to say, QuickDrawェ 3D must also be installed in your system.
Version History
Changes in Version 1.1:
・ radically simplified the user interface, particularly for setting preferences
・ customized the 3D viewer: drag-and-drop is no longer supported, but user-settable rotation is; in addition, clocks continue to tick even though the user is in the middle of rotating, moving, or scaling them
・ changed the default clock model so that the main clock face is hollow; this way, the time can be seen (albeit in reverse) even if the clock is rotated by 180 degrees
・ made a number of small performance, reliability, and efficiency tune-ups
・ improved (slightly) the handling of low-memory conditions
As QuickDrawェ 3D is a relatively new technology, the 3D routines which Clock^3 depends on may themselves have bugs. In particular, memory management in QuickDrawェ 3D may still have occasional leaks and glitches. In these cases, please download the latest version of QuickDrawェ 3D whenever it becomes available. At this writing, the latest version is 1.0.4.
System Requirements
Clock^3 requires a Power Macintosh with QuickDrawェ 3D version 1.0.3 or higher and at least 16 megabytes of total memory. It has been explicitly tested on the following systems: Power Macintosh 8500/120 with 32 megabytes of memory and System 7.5.3, PowerBook 5300/100 with 16 megabytes of memory and System 7.5.3, Power Macintosh 7100/80 with 24 megabytes of memory and System 7.5.1, Performa 5200/75 with 16 megabytes of memory and System 7.5.1, and Power Macintosh 7200/90 with 16 megabytes of memory and System 7.5.2.
User Guide
Clock^3 (pronounced メclock cubedモ) opens windows that display either its default internal 3D clock or a clock based on a 3DMF model on disk. The following paragraphs summarize the various controls, commands, and options in Clock^3. Clock^3 also has extensive balloon help, so you can get most of the information below (except for the keyboard shortcuts) by choosing メShow Balloonsモ from the Help menu.
Window Controls
A clock window in Clock^3 has the following controls and functions:
Close box: Dismisses the clock window.
Zoom box: Toggles between the standard clock size (full screen) and the user-defined size, as set by the Resize box.
Resize box: Resizes the clock window. Note that when a clock window changes size, the 3D clock within the window scales itself accordingly.
3D manipulation: Click and drag within the window area to rotate the clock; certain modifier keys (see below) can change this so that instead of rotating, you are either moving or scaling the clock. If the clock window is set to rotate the clock within the window (see Clock^3 Preferences below), you can set the rotation velocity of the overall model by using the mouse to メthrowモ the clock in the desired direction and speed of the rotation.
Keyboard Shortcuts
The following keyboard shortcuts can be used within a clock window. To use them, hold down the specified keys while dragging the mouse within the clock window.
scale instead of rotate control key
move instead of rotate shift key
Menu Commands
The following functions are available via menu commands:
File Menu
New: Opens a new clock window. The clock that is opened is either Clock^3ユs internal default clock or a 3DMF model specified by the user (see Clock^3 Preferences below).
Close: Closes the frontmost clock window.
Importノ: Imports a standard 3DMF model on your hard disk into a new clock window.
Exportノ: Exports the current clock to a standard 3DMF model. If a file with that name already exists, you will be asked if you want to replace it.
Quit: Quits from Clock^3.
Edit Menu
Undo: Disabled, because this operation is not present in Clock^3.
Cut: When a dialog box with text fields is active, moves the selection in the current text field onto the clipboard, thus deleting that selection from the text field. This command does not apply to a clock window.
Copy: Copies the current content of the frontmost clock window (or the selection in a dialog box with text fields) onto the clipboard. The content of the clock window (or text field) itself is unchanged.
Paste: Copies the current content of the clipboard onto an active dialog box with text fields. This command does not apply to a clock window.
Clear: Disabled, because this operation is not present in Clock^3.
Select All: Disabled, because this operation is not present in Clock^3.
Preferencesノ: Displays the Clock^3 Preferences dialog box. When invoked while at least one clock window is open, the Clock^3 Preferences affect the frontmost clock window. If invoked when no clock windows are open, the preferences affect the overall default settings. See below for an explanation of the Clock^3 Preferences dialog box.
The Clock^3 Preferences Dialog Box
This section explains the options available in the Clock^3 Preferences dialog box. A preview window within the dialog box gives you constant feedback on the clock specified by the current preferences. If a clock window is active at the time that the dialog box is opened, these preferences will affect the setup in that window. If no clock windows are open, then the preferences dialog box affects the overall Clock^3 defaults. Alternatively, you can set the Clock^3 defaults at any time by clicking on the Make Default button (see below).
Factory Reset: Click this button to set the preferences to Clock^3ユs internal defaults ム that is, the preferences used by Clock^3 when running it for the first time.
Clock Source
Use this section to determine the model that is used whenever Clock^3 opens a new clock window. The source model may be applied to the frontmost clock window or to the overall Clock^3 default, such that subsequent clock windows are opened using this model.
Internal Model / External 3D Model: Use these radio buttons to determine the clock model to be used by Clock^3. The internal model is a built-in clock that Clock^3 can create at any time. The external 3D model is based on a 3DMF file that exists somewhere on your system. The name of the current external 3D model is shown below the External 3D Model radio button.
Clock Source Options
Use this section to set preferences that are specific to whether you are using an internal model or an external 3D model. The options that appear depend on the clock source that you are currently using.
Internal Model Clock Source Options
Face Colorノ: This button opens a color selection dialog box that determines the color of the factory clockユs face and body.
Jewel Colorノ: The factory clock has a small メjewelモ on its face that indicates the 12 oユclock position. Click this button to set its color.
Hand Setupノ: This button opens the Hand Setup dialog box, which is used to determine the position, orientation, size, and color of the clockユs hour, minute, and second hands.
External Model Clock Source Options
External Modelノ: Click this button to choose a 3DMF file on your system from which Clock^3 will build its 3D clock. This file can be any standard 3DMF file. Be aware of the fileユs size and complexity; these factors greatly affect the Clock^3ユs speed and memory consumption.
Use Hands in Model: This check box is only enabled if Clock^3 has detected objects in the external 3D model that can function as clock hands. A 3DMF file has clock hands if they meet the criteria described in the section Technical Details. If you do not check this box, Clock^3 will automatically add a default set of clock hands to the model.
Hand Setupノ: If the Use Hands in Model check box is either unchecked or disabled, then you can use the Hand Setupノ button to invoke the Hand Setup dialog box. Using the Hand Setup dialog box, you can determine the position, orientation, size, and color of the clockユs hour, minute, and second hands.
Lights
Use this section to set up the lighting environment for your three-dimensional clock. On the left side of the Lights section is an entry field with a nudge control. Use this field to set the brightness of your lights. Valid brightness ranges from 0.0 to 1.0.
Light Colorノ: Click this button to choose the color of the lighting for the clock scene.
Other Clock Preferences
Tick Sound: Click this button if you want clocks to run with an audible tick.
Rotate Clock: Click this button if you want clocks to rotate as they run. You can set the rotation velocity by grabbing a clock with the mouse then メthrowingモ it in the desired direction with the desired speed.
Background Colorノ: Click this button to choose the color of the background area of the scene.
The buttons at the bottom of the dialog box either set or cancel the current set of preferences.
Make Default: Click this button to save the current preferences as the overall Clock^3 default. Note that this button is disabled when you invoke the preferences when no clock windows are open, because at that point the preferences always affect the default settings.
Cancel: Click this button to get out of the preferences dialog box while leaving the active clock window (or the Clock^3 defaults) untouched.
OK: Click this button to set your current preferences, either into the active clock window or the Clock^3 defaults (depending on whether or not a clock window is currently open). Clock^3 will dim this button for you if it senses that the current set of preferences is exactly the same as the original set.
The Hand Setup Dialog Box
Use the Hand Setup dialog box to define a clock hand setup. Ideally, I would have wanted a fully visual, highly interactive interface for defining clock hands; however, I do not have the time nor resources to achieve that goal. In fact, if I did that, I may as well write a full-blown 3D modeling program! So, please bear with the somewhat arduous way that the Hand Setup dialog box is set up.
The Hand Setup dialog box consists of a 3D preview of how the clock hands are to appear. You may rotate, move, or scale this preview as you would a standard clock window or the preview in the Clock^3 Preferences dialog box; manipulation of the 3D scene is exactly the same in all three instances.
Two toggles are available to you for configuring the Hand Setup preview. These are:
Show Time: Check this if you want Clock^3 to show you how the hands look when displaying the current time.
Render as Wireframe: Check this if you want to Hand Setup preview to be drawn as a wireframe. This permits you to see through a clock model, and also refreshes faster than a solid rendering.
Clock hands have four major elements: a position, a direction, size, and color. I will discuss each of them here; their corresponding controls in the Hand Setup dialog box should be pretty evident. Use Balloon Help for specific instructions on each control.
Position
Position determines where the clock hands are located. The position is specified as a three-dimensional point; specifically, this point is the fulcrum around which the clock hand rotates. Just experiment with these coordinate values to get a feel for how they affect a clock handユs location.
Direction
Direction is a little more complicated; it determines how the clock hands rotate when they tell time. Direction here is expressed as a 3D vector; for those of a non-mathematical bent, think of a vector as an arrow in 3D space.
The arrow relates to the clock hand in the following manner: real life clock hands turn around some kind of axle or rod, right? Well, the direction vector is precisely that axle: the clock hand rotates as if one end of the hand were fastened to it. The math-aware will recognize this vector as being normal to the clock hand.
For example, the default direction vector is (0, 0, 1). This means that the arrow lies on the z axis, and, in a default state, that z axis points toward you in the positive direction. Thus, the clock hands rotate as you would expect them to rotate when you are looking at the clock face head on: clockwise, and perpendicular to your line of sight. To make a clock hand rotate counterclockwise when facing you, set the direction vector to (0, 0, ミ1). Similarly, you can make the clock hand rotate in virtually any which way by tweaking the direction vector as appropriate.
Size
Thankfully, itユs downhill from here. Size consists of the length and width of a clock hand. Note that for simplicity, I fix the thickness of a clock hand; thus, the wider a clock hand is, the flatter it looks.
Color
Color is another thankfully simple attribute of a clock hand. Click on the appropriate Colorノ button to assign it; you can give a different color to the hour, minute, and second hand.
Two other buttons help you to quickly set up the clock hands: Use Default Hands and Use Factory Hands. The Use Default Hands button sets the dialog box to the current default hand setup. The Use Factory Hands button automatically fills the dialog box with the standard, factory-preset position, direction, size, and color of the clock hands.
Technical Details
The user interface for creating, editing, and configuring clock hands is limited by design. This is primarily because shooting for the moon with clock hand definition would have meant pretty much writing a メrealモ 3D-modeling program, which is currently beyond my reach. Thus, you can view the clock hand setup features of Clock^3 as sort of a toy, for play and experimentation, just to see what you can make it do. After all, Clock^3ユs real purpose is to display a 3D clock, not to build one!
In this section, I provide instructions for the more 3D-savvy on how to create truly custom clocks. Ideas include a Mickey Mouse watch, sundial-like clocks, etc. I will use QuickDrawェ 3Dユs terminology here; please translate as necessary into the terminology of your favorite 3D modeler.
Clock^3 recognizes a set of clock hands if the following conditions are met:
・ the clock hands are QuickDrawェ 3D group objects
・ these group objects are the last three objects specified in the model
・ these group objects contain a RotateAboutAxis transformation object
If these objects are found in a model, then Clock^3 tries to rotate them based on the current time. The kind of rotation involved is embedded in the RotateAboutAxis transformation (this corresponds directly to the direction vector described above).
Therefore, to create a truly custom clock, create a 3D model whose last three objects satisfy the above criteria. One final note: as I do not have access to a QuickDrawェ 3D-savvy modeler, the above technical details have not been fully tested. I can only say that I wrote Clock^3 to follow the above rules; whether it really does follow them in all cases remains to be seen. I will appreciate any feedback, effusive or constructive, from anyone who takes an interest in this program!
Known Problems and Cautions
Because this developer does not have very much in term of time or material resources, and also because QuickDrawェ 3D is still a nascent and very challenging technology, Iユd like to mention a few caveats to users of Clock^3:
・ Be careful with large 3DMF models, or keeping many 3DMF models open at once; make sure that your system configuration (i.e. amount of available RAM) can handle the models that you use. Version 1.1 has improved Clock^3ユs handling of low memory conditions. However, as a very small developer with limited resources, I cannot guarantee all memory-related errors are handled elegantly. At the very least, I can say with confidence that most of these errors occur in high memory demand situations, i.e. large 3DMF models or sufficiently many open 3DMF models. So please be careful when your Clock^3 usage falls into either category.
If you do encounter a low-memory condition (and this time Clock^3 will sometimes catch it for you without crashing), I recommend that you quit immediately, then avoid that situation later on. This may involve limiting yourself to smaller 3DMF models, or limiting the number of Clock^3 windows open at once.
Credits
Many thanks to my beta testers: Herman Atienza, Chris Larson, and the Lombos brothers.
In what may become a common thread in most of my software, many thanks go to Chris Larson for much technical and religious guidance. Iユm glad that Santa stuffed your stocking with a couple of 8-meg SIMMs this Christmasノ
Legal & Contact Information
Clock^3 is volunteerware ム that is, you are free to provide any kind of positive reinforcement to the programmer (grin) if you like his software. But seriously, at the very least, I would very much appreciate a short e-mail message if you like Clock^3 and have decided to use it for yourself. This at least gives me an idea of how it is being received out there.
I give my permission to include Clock^3 in any freeware or shareware CD. However, please inform me if your intention, so that I can keep track of which CDs contain my software.
Please direct all correspondence concerning Clock^3 to: dondi@cs.ucla.edu. Enjoy!